/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package it.evento;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Ilo
 */
@Entity
@Table(name = "PREFERENCES")
@NamedQueries({
    @NamedQuery(name = "Preferences.findAll", query = "SELECT p FROM Preferences p")})
public class Preferences implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected PreferencesPK preferencesPK;

    public Preferences() {
    }

    public Preferences(PreferencesPK preferencesPK) {
        this.preferencesPK = preferencesPK;
    }

    public Preferences(int idevent, int iduser) {
        this.preferencesPK = new PreferencesPK(idevent, iduser);
    }

    public PreferencesPK getPreferencesPK() {
        return preferencesPK;
    }

    public void setPreferencesPK(PreferencesPK preferencesPK) {
        this.preferencesPK = preferencesPK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (preferencesPK != null ? preferencesPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Preferences)) {
            return false;
        }
        Preferences other = (Preferences) object;
        if ((this.preferencesPK == null && other.preferencesPK != null) || (this.preferencesPK != null && !this.preferencesPK.equals(other.preferencesPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "it.evento.Preferences[ preferencesPK=" + preferencesPK + " ]";
    }
    
}
